﻿using Microsoft.Practices.Unity.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Artech.Common
{
    public class WcfInvoker
    {
        public static void Invoke<TChannel>(string endpointName, Action<TChannel> action)
        {
            throw new NotImplementedException();
        }

        public static TResult Invoke<TChannel, TResult>(string endpointName, Func<TChannel, TResult> func)
        {
            throw new NotImplementedException();
        }
    }

    public class WcfInvoker<TChannel> : WcfInvoker
    {
        public string EndpointName { get; private set; }
        public WcfInvoker(string endpointName)
        {
            Guard.ArgumentNotNullOrEmpty(endpointName, "endpointName");
            this.EndpointName = endpointName;
        }

        public void Invoke(Action<TChannel> action)
        {
            Invoke<TChannel>(this.EndpointName, action);
        }

        public TResult Invoke<TResult>( Func<TChannel, TResult> func)
        {
            return Invoke<TChannel, TResult>(this.EndpointName, func);
        }
    }
}
